package edu.nf.webapp.exception;

import edu.nf.webapp.result.ResultData;
import org.nf.web.annotation.ExceptionAdvice;
import org.nf.web.annotation.ExceptionHandler;
import org.nf.web.servlet.View;
import org.nf.web.view.JsonView;

/**
 * @author wangl
 * @date 2024/5/21
 */
@ExceptionAdvice
public class GlobalExceptionAdvice {

    @ExceptionHandler(LoginException.class)
    public View handleLoginException(LoginException e) {
        ResultData r = new ResultData();
        r.setCode(e.getErrorCode());
        r.setMessage(e.getMessage());
        return new JsonView(r);
    }
}